<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%option explicit
Response.Buffer = True    
Response.ExpiresAbsolute = Now() - 1    
Response.Expires = 0    
Response.CacheControl = "no-cache"
'作者：山林客（ah_bill）
'博客：http://ruizhinet.blog.163.com
'网站：http://www.ruizhinet.cn
'本信息不会影响您网站的正常访问，请保留
%>
<%
Dim RZ_IN
RZ_IN=1
%>
<!--#include file="../conn.inc.asp" -->
<!--#include file="../client_inc/common.function.asp" -->
<!--#include file="../client_inc/common.class.asp" -->
<!--#Include file="../client_inc/sqlsecure.asp"-->
<%
Dim title,author,email,content,recordid,rsa,sqla,rsb,sqlb,path,typeid,lang,fenlei
recordid=HTMLEncode(request.Form("recordid"))
path=HTMLEncode(request.Form("path"))
typeid=HTMLEncode(request.Form("typeid"))
lang=HTMLEncode(request.querystring("lang"))
If lang="" Then
lang=0
End If 

If (Not isNumber(recordid)) Or path="" Or (Not isNumber(typeid)) Then 
	out("lang_invalid")
	response.End()
End If 

title=HTMLEncode(request.Form("title"))
If IsNull(title) Or IsEmpty(title) Then 
title=""
End If 
author=HTMLEncode(request.Form("author"))
email=HTMLEncode(request.Form("email"))
content=HTMLEncode(request.Form("content"))	
if content="" then
	out("lang_emptycontent")
	response.End()
end if
if Len(content)>1000 then
	out("lang_lessthen1000")
	response.End()
end If

Set rsb=Server.CreateObject("ADODB.Recordset")
sqlb = "select fenlei from [c_type] where id="&typeid
rsb.open sqlb,conn,1,1
If Not rsb.eof Then 
fenlei=rsb("fenlei")
End If 
rsb.close
Set rsb=Nothing 

If fenlei<>"" Then 
Set rsa = Server.CreateObject("ADODB.Recordset")
sqla = "select * from [c_record_comment]"
rsa.open sqla,conn,1,3
rsa.addnew
rsa("title")=title
rsa("author")=author
rsa("email")=email
rsa("content")=content
rsa("recordid")=recordid
rsa("path")=FillPath(path)
rsa("typeid")=typeid
rsa("lang")=lang
rsa("fenlei")=fenlei
rsa("addtime")=Now
rsa("replytime")="2000-1-1 01:01:01"

If app("rz_commentaudit")="1" Then 
	rsa("visible")=0
Else
	rsa("visible")=1
End If 
rsa.update
rsa.close
set rsa=Nothing

response.write("alert('"&getstr("lang_savecomment")&"');")
If app("rz_sendmail_comment")=1  Then 
Dim emailcontent
emailcontent="<h1>"&title&"</h1>"
emailcontent=emailcontent&"作者:"&author&"<br/>"
emailcontent=emailcontent&"Emal:"&email&"<br/>"
emailcontent=emailcontent&"时间:"&Now()&"<br/>"
emailcontent=emailcontent&content
emailcontent=emailcontent&"<hr/>"
emailcontent=emailcontent&"详情请登陆网站：<a href="""&app("rz_website_address")&""">"&app("rz_website_address")&"</a>"
Dim rand
randomize
rand=int(90000000*rnd)+10000000
session("sendemail_rand")=rand
response.write("sendMail('新评论："&title&"','"&emailcontent&"','"&rand&"');")
End If 
Else
out("lang_invalid")
End If 
%>	
